﻿using AgencyManagerSystem.Common;
using AgencyManagerSystem.Model;
using Dapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AgencyManagerSystem.DataFetcher
{
    public class OrderDetailFetcher : DetailFetcher<OrderDetailModel>
    {
        public OrderDetailFetcher() : base()
        {

        }
        public override IList<OrderDetailModel> ListDetail(int mainId)
        {
            Condition[] conditions = new Condition[] { new Condition() { Key = "OrderId", Op = "=", Value = mainId } };
            var list = List(conditions);
            return list;
        }
        public override void AddDefaultFilter(StringBuilder stringBuilder, DynamicParameters dynamicParameters)
        {
  
        }
        public override IList<OrderDetailModel> ListDetail(int mainId, int pos, int size)
        {
            Condition[] conditions = new Condition[] { new Condition() { Key = "OrderId", Op = "=", Value = mainId } };
            var list = List(conditions, pos, size);
            return list;
        }
        public virtual IList<OrderDetailModel> ListByProduction(int productionId)
        {
            Condition[] conditions = new Condition[] { new Condition() { Key = "ProductionId", Op = "=", Value = productionId } };
            var list = List(conditions);
            return list;
        }
    }
}
